﻿using System;
using System.Collections.Generic;
using DomainModel;
using Repository.Abstract;
using Services.Abstract;

namespace Services.Concrete
{
    public class MarkService : Service<Mark>, IMarkService
    {
        private readonly IMarkRepository _markRepository;

        public MarkService(IMarkRepository markRepository)
            : base(markRepository)
        {
            _markRepository = markRepository;
        }

        public Mark Get(string name)
        {
            if (string.IsNullOrEmpty(name)) 
                throw new ArgumentNullException("name");

            return _markRepository.GetMarkByName(name);
        }

        /*public Mark GetMark(string name)
        {
            if (string.IsNullOrWhiteSpace(name))
                return null;

            return DAOFactory.DEFAULT.MarkDAO.GetByName(name);
        }

        public void Save(Mark entity)
        {
            if (entity == null)
                return;

            DAOFactory.DEFAULT.MarkDAO.SaveOrUpdate(entity);
        }

        public void Delete(Mark entity)
        {
            if (entity == null)
                return;

            DAOFactory.DEFAULT.MarkDAO.Delete(entity);
        }

        public Mark GetById(long id)
        {
            if (id <= 0)
                return null;

            return DAOFactory.DEFAULT.MarkDAO.GetById(id);
        }

        public List<Mark> GetAll()
        {
            return DAOFactory.DEFAULT.MarkDAO.GetAll().ToList();
        }*/
    }
}